package com.linjuke.mayouting.biz.bo.impl;

import java.util.List;

import com.linjuke.mayouting.biz.ao.query.UserQuery;
import com.linjuke.mayouting.biz.bo.UserBO;
import com.linjuke.mayouting.biz.dal.daointerface.UserDAO;
import com.linjuke.mayouting.biz.dal.dataobject.UserDO;
import com.zjuh.sweet.codec.MD5;

public class UserBOImpl implements UserBO {

	private UserDAO userDAO;

	@Override
	public int create(UserDO userDO) {
		return userDAO.create(userDO);
	}

	@Override
	public void delete(int userId) {
		userDAO.delete(userId);
	}

	@Override
	public void update(UserDO userDO) {
		userDAO.update(userDO);
	}

	@Override
	public UserDO queryById(int userId) {
		return userDAO.queryById(userId);
	}

	@Override
	public UserDO queryByUsername(String username) {
		return userDAO.queryByUsername(username);
	}

	@Override
	public String encryptPassword(String password) {
		return MD5.encrypt(password);
	}

	public List<UserDO> queryUsersForPage(UserQuery userQuery) {
		return userDAO.queryUsersForPage(userQuery);
	}

	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

}
